# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.FirebaseHosting.V1beta1.Model.CustomDomain do
  @moduledoc """
  A `CustomDomain` is an entity that links a domain name to a Firebase Hosting site. Add a `CustomDomain` to your site to allow Hosting to serve the site's content in response to requests against your domain name.

  ## Attributes

  *   `annotations` (*type:* `map()`, *default:* `nil`) - Annotations you can add to leave both human- and machine-readable metadata about your `CustomDomain`.
  *   `cert` (*type:* `GoogleApi.FirebaseHosting.V1beta1.Model.Certificate.t`, *default:* `nil`) - Output only. The SSL certificate Hosting has for this custom domain's domain name. For new custom domains, this often represents Hosting's intent to create a certificate, rather than an actual cert. Check the `state` field for more.
  *   `certPreference` (*type:* `String.t`, *default:* `nil`) - A field that lets you specify which SSL certificate type Hosting creates for your domain name. Spark plan custom domains only have access to the `GROUPED` cert type, while Blaze plan domains can select any option.
  *   `createTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The custom domain's create time.
  *   `deleteTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The time the `CustomDomain` was deleted; null for custom domains that haven't been deleted. Deleted custom domains persist for approximately 30 days, after which time Hosting removes them completely. To restore a deleted custom domain, make an `UndeleteCustomDomain` request.
  *   `etag` (*type:* `String.t`, *default:* `nil`) - Output only. A string that represents the current state of the `CustomDomain` and allows you to confirm its initial state in requests that would modify it. Use the tag to ensure consistency when making `UpdateCustomDomain`, `DeleteCustomDomain`, and `UndeleteCustomDomain` requests.
  *   `expireTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The minimum time before a soft-deleted `CustomDomain` is completely removed from Hosting; null for custom domains that haven't been deleted.
  *   `hostState` (*type:* `String.t`, *default:* `nil`) - Output only. The `HostState` of the domain name this `CustomDomain` refers to.
  *   `issues` (*type:* `list(GoogleApi.FirebaseHosting.V1beta1.Model.Status.t)`, *default:* `nil`) - Output only. A set of errors Hosting systems encountered when trying to establish Hosting's ability to serve secure content for your domain name. Resolve these issues to ensure your `CustomDomain` behaves properly.
  *   `labels` (*type:* `map()`, *default:* `nil`) - Labels used for extra metadata and/or filtering.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Output only. The fully-qualified name of the `CustomDomain`.
  *   `ownershipState` (*type:* `String.t`, *default:* `nil`) - Output only. The `OwnershipState` of the domain name this `CustomDomain` refers to.
  *   `reconciling` (*type:* `boolean()`, *default:* `nil`) - Output only. A field that, if true, indicates that Hosting's systems are attmepting to make the custom domain's state match your preferred state. This is most frequently `true` when initially provisioning a `CustomDomain` after a `CreateCustomDomain` request or when creating a new SSL certificate to match an updated `cert_preference` after an `UpdateCustomDomain` request.
  *   `redirectTarget` (*type:* `String.t`, *default:* `nil`) - A domain name that this `CustomDomain` should direct traffic towards. If specified, Hosting will respond to requests against this custom domain with an HTTP 301 code, and route traffic to the specified `redirect_target` instead.
  *   `requiredDnsUpdates` (*type:* `GoogleApi.FirebaseHosting.V1beta1.Model.DnsUpdates.t`, *default:* `nil`) - Output only. A set of updates you should make to the domain name's DNS records to let Hosting serve secure content on its behalf.
  *   `updateTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The last time the `CustomDomain` was updated.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :annotations => map() | nil,
          :cert => GoogleApi.FirebaseHosting.V1beta1.Model.Certificate.t() | nil,
          :certPreference => String.t() | nil,
          :createTime => DateTime.t() | nil,
          :deleteTime => DateTime.t() | nil,
          :etag => String.t() | nil,
          :expireTime => DateTime.t() | nil,
          :hostState => String.t() | nil,
          :issues => list(GoogleApi.FirebaseHosting.V1beta1.Model.Status.t()) | nil,
          :labels => map() | nil,
          :name => String.t() | nil,
          :ownershipState => String.t() | nil,
          :reconciling => boolean() | nil,
          :redirectTarget => String.t() | nil,
          :requiredDnsUpdates => GoogleApi.FirebaseHosting.V1beta1.Model.DnsUpdates.t() | nil,
          :updateTime => DateTime.t() | nil
        }

  field(:annotations, type: :map)
  field(:cert, as: GoogleApi.FirebaseHosting.V1beta1.Model.Certificate)
  field(:certPreference)
  field(:createTime, as: DateTime)
  field(:deleteTime, as: DateTime)
  field(:etag)
  field(:expireTime, as: DateTime)
  field(:hostState)
  field(:issues, as: GoogleApi.FirebaseHosting.V1beta1.Model.Status, type: :list)
  field(:labels, type: :map)
  field(:name)
  field(:ownershipState)
  field(:reconciling)
  field(:redirectTarget)
  field(:requiredDnsUpdates, as: GoogleApi.FirebaseHosting.V1beta1.Model.DnsUpdates)
  field(:updateTime, as: DateTime)
end

defimpl Poison.Decoder, for: GoogleApi.FirebaseHosting.V1beta1.Model.CustomDomain do
  def decode(value, options) do
    GoogleApi.FirebaseHosting.V1beta1.Model.CustomDomain.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.FirebaseHosting.V1beta1.Model.CustomDomain do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
